package com.treasure.mall.biz.service.core.statistics;

import com.treasure.mall.biz.base.SearchableCrudService;
import com.treasure.mall.biz.base.UserDetails;
import com.treasure.mall.biz.dto.order.OrderStatisticsDTO;
import com.treasure.mall.biz.dto.order.UserOrderCountDTO;
import com.treasure.mall.biz.entity.statistics.OrderStatisticsPO;
import org.springframework.data.domain.Page;

import java.time.LocalDate;
import java.util.List;

/**
 * 订单统计
 *
 * @author allan
 * @version 1.0.0
 * @date 2020/6/19
 */
public interface OrderStatisticsService extends SearchableCrudService<OrderStatisticsPO, Long> {

    /**
     * 订单统计
     *
     * @return
     */
    OrderStatisticsDTO orderStatistics(UserDetails userDetails);

    /**
     * 用户的订单数量
     *
     * @param userId
     * @return
     */
    UserOrderCountDTO userOrderCount(Long userId);

    /**
     * 待发货数量
     *
     * @param userDetails
     * @return
     */
    int toDeliverNum(UserDetails userDetails);

    /**
     * 退款订单数
     * 售后单数量-售后完成数量
     *
     * @param userDetails
     * @return
     */
    int afterSaleNum(UserDetails userDetails);

    /**
     * 昨日访客数量
     *
     * @param userDetails
     * @return
     */
    int yesterdayUv(UserDetails userDetails);

    void statistics(LocalDate date);

    List<OrderStatisticsPO> sevenDays();

    Page<OrderStatisticsPO> findAll(int pageIndex, int pageSize, String begin, String end);
}
